import java.io.*;
import java.lang.*;

public class tester extends Thread{
    Pipe p;
    int x;
    String temp = "";
    public tester(Pipe p,int x){
        this.p = p;
        this.x =x;
    }
    
    
    public void run(){
        
        
        if(x == 1){
        	//multiple writes (1008 char total)
            p.writePipe("this is a test of alot of the different I want to make this test longer than 1024 char so that it will test this programs ability to be patient\n");
            p.writePipe("this is a test of alot of the different I want to make this test longer than 1024 char so that it will test this programs ability to be patient\n");
            p.writePipe("this is a test of alot of the different I want to make this test longer than 1024 char so that it will test this programs ability to be patient\n");
            p.writePipe("this is a test of alot of the different I want to make this test longer than 1024 char so that it will test this programs ability to be patient\n");
            p.writePipe("this is a test of alot of the different I want to make this test longer than 1024 char so that it will test this programs ability to be patient\n");
            p.writePipe("this is a test of alot of the different I want to make this test longer than 1024 char so that it will test this programs ability to be patient\n");
        }else if(x ==2){
	        
            p.readPipe(1024);
        }
        else if(x==3){
        	//closes the pipe
	        try{
                sleep(1000);
           }catch(Exception e){}
          p.closePipe();
        }
        else if(x == 4){
	    	p.writePipe("");
	    	p.writePipe("3");
	    	   		
        }
        else if(x == 5){
	        p.readPipe(-20);
	        p.readPipe(1);
        }
        else if(x == 6){
	        try{
		        sleep(100);
	        }catch(Exception e){}
	        p.readPipe(865);
        }
        else if(x ==7){
        	p.writePipe("This string is 23 chars");
	    }
	    else if(x == 8){
	    	p.readPipe(10);
			    
		}
        	
       
        
    }

}